package com.chenfeng.ego.rest.controller;
import javax.annotation.Resource;
import org.springframework.http.converter.json.MappingJacksonValue;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.chenfeng.ego.rest.service.ShowPicService;
import com.chenfeng.ego.rest.service.TbItemCatService;
@Controller
public class TbItemCatController
{	@Resource
	private TbItemCatService tbItemCatService;
	//跨域请求数据的格式  相应结果的类型dataType:"jsonp" jsonp:"callback"传回去的参数名  jsonpCallback:"abc" 传递的方法名 
	//spring自带的MappingJacksonValue支持jsonp的接口
	@RequestMapping(value = "rest/itemcat/all",method={RequestMethod.GET})
	@ResponseBody
	public MappingJacksonValue showResult(String callback)
	{
		//将值设进去
		MappingJacksonValue mvj = new MappingJacksonValue(tbItemCatService.finaMenu());
		mvj.setJsonpFunction(callback);
		return mvj;
	}
}
